package com.wjb.springcloud.controller;

import com.wjb.springcloud.pojo.FeignClient;
import com.wjb.springcloud.pojo.FeignClient2;
import com.wjb.springcloud.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class FeignController {

    @Autowired
    private FeignClient feignClient;
    @Autowired
    private FeignClient2 feignClient2;

    @RequestMapping(value = "/feign",method = RequestMethod.GET)
    public Student findbyId(@RequestParam(value = "id") Integer id){
        return feignClient.findById(id);
    }
    @RequestMapping(value = "/feign2",method = RequestMethod.POST)
    public Student hi(){
        return  feignClient.findById2();
    }
    @RequestMapping(value = "/findservice/{service}",method = RequestMethod.GET)
    public String findservice(@PathVariable("service") String service){
        return feignClient2.findnamebyname(service);
    }
}
